home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / CRACKBB.ZIP / Cracking2.txt < prev    next >
Text File  |  1996-05-18  |  27KB  |  589 lines

  1.  
  2.                          CRACKING 101 - 1990 edition
  3.  
  4.                                    Lesson #2
  5.  
  6.                              ┌──────────────────┐
  7.                              │ DOC CHECK PRIMER │
  8.                              └──────────────────┘
  9.  
  10.                               by Buckaroo Banzai
  11.  
  12.  
  13.     Ok, in this textfile, I will start talking about removing doc check
  14. protection schemes. I find, the doc check scheme to be slightly more
  15. difficult to work on than normal INT 13 schemes.
  16.  
  17.     What is a doc check. Usually, a doc check when a program ask the user to
  18. enter a phrase or code supplied with the manual. Now, one might think that
  19. "Shit, we can just type all the codes in to a textfile and upload it with the
  20. DOCS", but that way of thinking breaks down on programs such as Future
  21. Classics where there are 6 pages with about 200 codes per page. So it is just
  22. better to remove the check completely.
  23.  
  24.     In this primer, I will get in to the theory of removing a doc check, then
  25. start with a simple example (Electronic Art's ESCAPE FROM HELL). Then in the
  26. next file, I will take you deeper in to the world of doc checks and work with
  27. more difficult examples. But for now, lets get started.
  28.  
  29.     A doc check, in basic theory works much like normal INT 13 copy
  30. protection. Somewhere in the beginning of the program before it really
  31. starts, the check is  made. If the result is ok (ie the user enters the
  32. correct word or phrase) then the program continues. If not, then the program
  33. simply exits to dos.
  34.  
  35.     Simple right, well not really. Usually, the input routine is part of the
  36. standard input routine of the program so you just can't go about modify the
  37. call to INT 16h (the keyboard interrupt) like you could with INT 13h. So,
  38. where do we start. If you think back to cracking the old INT 13 protection
  39. schemes, you would use a program like PCWATCH or TRAP13 to get a rough idea
  40. of where the call resides. With doc checks, this is really not the best way
  41. to do it.
  42.  
  43.     I suggest that you try to break in to the program well before the
  44. protection is checked. Remember, we must remove the check without messing
  45. with the actual input routine so we want to come in highest level.
  46.  
  47.     So, how do we break in. By using a good debugger. I suggest Periscope. I
  48. find it is the best and easiest to use. Once we are in, all the is left is to
  49. trace through the program until we find the topmost call to the doc check.
  50. Now we're moving.
  51.  
  52.     So let's say we have broken in to the program and found the topmost call
  53. to the doc check. What next. We must try to figure out what the program does.
  54. There are 2 possibilities. First, the program could simply check the inputed
  55. string against a value in memory, and if they don't match simply exit to dos
  56. and if they do, just continue with the program; or if the input matches it
  57. can set a flag in memory that is checked by some routine later.
  58.  
  59.     So, on to the example. NOTE! All address might be different. This is how
  60. it looked when I cracked it. ALSO NOTE, you should be cracking without any
  61. memory resident programs. Make sure MEMORY is clear, and that you load the
  62. system the same  way each time. Remember, if you load everything the same,
  63. everything will be in the same memory location.
  64.  
  65.     So, what is our first step. Well, I suggest picking out the right tools
  66. to do the job. In this case, You will only need PERISCOPE (and the addin
  67. program that comes with it called PSKEY) and a good file editor (when I say
  68. good I mean it can edit and search in hex).  So let's get started.
  69.  
  70.     First, we load PERISCOPE (PS from now on). This is gonna be the debugger
  71. we use. Next, we need a quick way in to the debugger. Since ESCAPE FROM HELL
  72. (EFH from now on) is not all the picky about how it keeps a crackest out,
  73. PSKEY will do just fine but not without using a little trick.
  74.  
  75.     Normally, when using PSKEY (for those of you who do not know what PSKEY
  76. does, it allows up to break in to PS usings a TSR hotkey) and you hit the
  77. hotkey, PSKEY does an INT 2h (NMI). This then brings up PS and you are set.
  78. But, EFH revectors INT 2h (NMI) to simply an IRET so this method does not
  79. work. How do we get around this, well, INT 2h is the default used with PSKEY
  80. but not the only way to work it. You can also use INT 3h (Breakpoint
  81. interrupt) or INT 15h (Extended services interrrupt) to activate PS. In this
  82. case we will use INT 3h; so when we invoke PSKEY we add the command line
  83. parameter "3" (ie: "PSKEY  3CAL" invokes PSKEY using INT 3h setting the
  84. hotkey to CTRL-ALT-LEFT_SHIFT).
  85.  
  86.     So, now that we have a way in to EFH, where do we want to break out. Well
  87. folks, I don't have any formula to give, but remember, I suggest that we try
  88. to break in to the outermost loop. So, experiance (and a good fucking guess)
  89. tells me to break out in the title screen before the music begins.
  90.  
  91.     It just so happens that this time I was right (And noone had to get nail
  92. to anything -D.A.) Right after the title picture comes up, press your hotkey
  93. (oooh). The PS debugging screen should come up and you should see the follow
  94. section of code..
  95.  
  96.      2309:019C CF            IRET
  97.      2309:019D 3D0085        CMP AX,8500
  98.      etc.
  99.  
  100.      This is the exit code from PSKEY. By usings the J(ump) command, and
  101. executing the IRET, you will be put back right to the spot where you pressed
  102. the hotkey (boy I'm getting excited). I would love to give you a code
  103. fragment here, but each time you press the hotkey you will end up at a
  104. different point.
  105.  
  106.     So what do we do next. Well, we will just have to keep executing code
  107. until we find some reference point. Remember how I said we wanted to break
  108. out before we reached to music at the title screen. Well, you can bet that we
  109. are in the outermost loop since the music comes before the doc check and we
  110. haven't reached the call to the music routine yet. So we start executing
  111. code.
  112.  
  113.     Then all of the sudden BOOM! you execute a CALL instruction and music
  114. bursts through the speaker. AHa, a reference point. We know we are on the
  115. right track.
  116.  
  117.     Press <ESC> during the music so that we can skip the stupid intro for
  118. now. After pressing <ESC> you should regain control at the instruction after
  119. the call to the music routine.
  120.  
  121.     From here on out, we want to procede rather slowly. Each time you reach a
  122. CALL instruction you want to write down the address where it is located.
  123. Sooner or later you will execute a CALL instruction and EFH will jump in to
  124. it's doc check routine. But damn, you have the address of the that call
  125. WRITTEN DOWN right. So simply reboot and reload everything.
  126.  
  127.     Break out in to PS at the title picture. Now, unassemble the address you
  128. wrote down. You should see something like this
  129.  
  130.     21DD:3EA4 9AA5368132     CALL 3281:36A5  (current line)
  131.     21DD:3EA4 9A522F8132     CALL 3281:2F52
  132.     21DD:3EA4 C706BB070000   MOV WORD PTR [07BB],0000
  133.     21DD:3EA4 8BE5           MOV SP,BP
  134.     21DD:3EA4 5D             POP BP
  135.     21DD:3EA4 CB             RETF
  136.  
  137.     The first call, is the call to the doc check, therefore it can for now
  138. be assumed that the second call is to the actual game (remember, most
  139. programmers follow good programming practice and will exit the routine that
  140. does the doc check to finish the game). Please NOTE, from here on out, if I
  141. say go back to STEP 1, reboot the machine, reload and get to this point.  Ok.
  142.  
  143.     Our first though in seeing code like this is shit maybe they just check
  144. the keyword and exit to dos if it's bad; if it it's good, then they just exit
  145. that subroutine and start the game. So having lots of time on our hands, we
  146. try just executing the second CALL and bypass the first (you can do that by
  147. setting the IP (instruction pointer) register to the offset of the second
  148. call [In our case 3EA9]). When you do this, the screen clears, and you see
  149. the character (Richard) on the screen. But just as you think it worked, it
  150. switches back to text mode and prints the message "Hell is HOT". Shit I hate
  151. it when that happens.
  152.  
  153.     So now we know that somewhere in the doc check routine, EFH sets a flag
  154. in memory. We must figure out where this flag is and figure out a way to fake
  155. it. So go back to step 1, this time, let's trace (using the T command) in to
  156. the doc check routine.
  157.  
  158.     I have included the entire outerloop of the doc check routine here. The
  159. small subroutines are not of any importants and infact when I first crack
  160. EFH, I never traced in to any of them. It wasn't until I was out getting this
  161. information that I took a look to see what they did.
  162.  
  163.     Here is the dos check code. I have place some basic instructions that
  164. should help you as you go along. Although you address might be different than
  165. mine, I will use mine for reference. Also, I have noted some special
  166. subroutines along the way.
  167.  
  168.         ( - Unassembled DOC CHECK for ESCAPE FROM HELL [outer loop] )
  169.  
  170.     First, we start off with some initialization routines. You don't need to
  171. be all to concerned with them.
  172.  
  173.     3281:36A5 55            PUSH BP
  174.     3281:36A6 8BEC          MOV BP,SP
  175.     3281:36A8 83EC2A        SUB SP,+2A
  176.     3281:36AB C746DE0000    MOV WORD PTR [BP-22],0000
  177.     3281:36B0 B80600        MOV AX,0006
  178.     3281:36B3 50            PUSH AX
  179.     3281:36B4 9AE3169900    CALL 0099:16E3
  180.     3281:36B9 59            POP CX
  181.     3281:36BA 48            DEC AX
  182.     3281:36BB 8946DA        MOV [BP-26],AX
  183.     3281:36BE B80F00        MOV AX,000F
  184.     3281:36C1 50            PUSH AX
  185.     3281:36C2 9AE3169900    CALL 0099:16E3
  186.     3281:36C7 59            POP CX
  187.     3281:36C8 48            DEC AX
  188.     3281:36C9 8946DC        MOV [BP-24],AX
  189.     3281:36CC C706CB070E00  MOV WORD PTR [07CB],000E
  190.     3281:36D2 C746D60000    MOV WORD PTR [BP-2A],0000
  191.     3281:36D7 E9C002        JMP 399A
  192.     3281:36DA C746D80000    MOV WORD PTR [BP-28],0000
  193.     3281:36DF E92501        JMP 3807
  194.     3281:36E2 9A9B479900    CALL 0099:479B
  195.     3281:36E7 B83866        MOV AX,6638
  196.     3281:36EA 50            PUSH AX
  197.     3281:36EB A03407        MOV AL,[0734]
  198.     3281:36EE B400          MOV AH,00
  199.     3281:36F0 50            PUSH AX
  200.     3281:36F1 B80C00        MOV AX,000C
  201.     3281:36F4 50            PUSH AX
  202.     3281:36F5 B8CF00        MOV AX,00CF
  203.     3281:36F8 50            PUSH AX
  204.     3281:36F9 8B46DC        MOV AX,[BP-24]
  205.     3281:36FC BA5800        MOV DX,0058
  206.     3281:36FF F7E2          MUL DX
  207.     3281:3701 8BD8          MOV BX,AX
  208.     3281:3703 8A87F640      MOV AL,[BX+40F6]
  209.     3281:3707 B400          MOV AH,00
  210.     3281:3709 8BD8          MOV BX,AX
  211.     3281:370B 81C39400      ADD BX,0094
  212.     3281:370F D1E3          SHL BX,1
  213.     3281:3711 D1E3          SHL BX,1
  214.     3281:3713 FFB7F25D      PUSH [BX+5DF2]
  215.     3281:3717 FFB7F05D      PUSH [BX+5DF0]
  216.     3281:371B 9AE7019900    CALL 0099:01E7
  217.     3281:3720 83C40C        ADD SP,+0C
  218.     3281:3723 8B46DA        MOV AX,[BP-26]
  219.     3281:3726 3D0500        CMP AX,0005
  220.     3281:3729 7603          JBE 372E
  221.     3281:372B E9B200        JMP 37E0
  222.     3281:372E 8BD8          MOV BX,AX
  223.     3281:3730 D1E3          SHL BX,1
  224.     3281:3732 2E            CS:
  225.     3281:3733 FFA73737      JMP [BX+3737]
  226.     3281:3737 43            INC BX
  227.     3281:3738 37            AAA
  228.     3281:3739 5E            POP SI
  229.     3281:373A 37            AAA
  230.     3281:373B 7837          JS 3774
  231.     3281:373D 92            XCHG DX,AX
  232.     3281:373E 37            AAA
  233.     3281:373F AC            LODSB
  234.     3281:3740 37            AAA
  235.     3281:3741 C637B8        MOV BYTE PTR [BX],B8
  236.     3281:3744 2000          AND [BX+SI],AL
  237.     3281:3746 50            PUSH AX
  238.     3281:3747 B82E01        MOV AX,012E
  239.     3281:374A 50            PUSH AX
  240.     3281:374B B88100        MOV AX,0081
  241.     3281:374E 50            PUSH AX
  242.     3281:374F B87348        MOV AX,4873
  243.     3281:3752 50            PUSH AX
  244.     3281:3753 9AD6029900    CALL 0099:02D6
  245.     3281:3758 83C408        ADD SP,+08
  246.     3281:375B E98200        JMP 37E0
  247.     3281:375E B82000        MOV AX,0020
  248.     3281:3761 50            PUSH AX
  249.     3281:3762 B82E01        MOV AX,012E
  250.     3281:3765 50            PUSH AX
  251.     3281:3766 B88100        MOV AX,0081
  252.     3281:3769 50            PUSH AX
  253.     3281:376A B88648        MOV AX,4886
  254.     3281:376D 50            PUSH AX
  255.     3281:376E 9AD6029900    CALL 0099:02D6
  256.     3281:3773 83C408        ADD SP,+08
  257.     3281:3776 EB68          JMP 37E0
  258.     3281:3778 B82000        MOV AX,0020
  259.     3281:377B 50            PUSH AX
  260.     3281:377C B82E01        MOV AX,012E
  261.     3281:377F 50            PUSH AX
  262.     3281:3780 B88100        MOV AX,0081
  263.     3281:3783 50            PUSH AX
  264.     3281:3784 B8AD48        MOV AX,48AD
  265.     3281:3787 50            PUSH AX
  266.     3281:3788 9AD6029900    CALL 0099:02D6
  267.     3281:378D 83C408        ADD SP,+08
  268.     3281:3790 EB4E          JMP 37E0
  269.     3281:3792 B82000        MOV AX,0020
  270.     3281:3795 50            PUSH AX
  271.     3281:3796 B82E01        MOV AX,012E
  272.     3281:3799 50            PUSH AX
  273.     3281:379A B88100        MOV AX,0081
  274.     3281:379D 50            PUSH AX
  275.     3281:379E B8C748        MOV AX,48C7
  276.     3281:37A1 50            PUSH AX
  277.     3281:37A2 9AD6029900    CALL 0099:02D6
  278.     3281:37A7 83C408        ADD SP,+08
  279.     3281:37AA EB34          JMP 37E0
  280.     3281:37AC B82000        MOV AX,0020
  281.     3281:37AF 50            PUSH AX
  282.     3281:37B0 B82E01        MOV AX,012E
  283.     3281:37B3 50            PUSH AX
  284.     3281:37B4 B88100        MOV AX,0081
  285.     3281:37B7 50            PUSH AX
  286.     3281:37B8 B8E848        MOV AX,48E8
  287.     3281:37BB 50            PUSH AX
  288.     3281:37BC 9AD6029900    CALL 0099:02D6
  289.     3281:37C1 83C408        ADD SP,+08
  290.     3281:37C4 EB1A          JMP 37E0
  291.     3281:37C6 B82000        MOV AX,0020
  292.     3281:37C9 50            PUSH AX
  293.     3281:37CA B82E01        MOV AX,012E
  294.     3281:37CD 50            PUSH AX
  295.     3281:37CE B88100        MOV AX,0081
  296.     3281:37D1 50            PUSH AX
  297.     3281:37D2 B80F49        MOV AX,490F
  298.     3281:37D5 50            PUSH AX
  299.     3281:37D6 9AD6029900    CALL 0099:02D6
  300.     3281:37DB 83C408        ADD SP,+08
  301.     3281:37DE EB00          JMP 37E0
  302.     3281:37E0 B82D00        MOV AX,002D
  303.     3281:37E3 50            PUSH AX
  304.     3281:37E4 B88200        MOV AX,0082
  305.     3281:37E7 50            PUSH AX
  306.     3281:37E8 9A96029900    CALL 0099:0296
  307.     3281:37ED 59            POP CX
  308.     3281:37EE 59            POP CX
  309.     3281:37EF B82849        MOV AX,4928
  310.     3281:37F2 50            PUSH AX
  311.     3281:37F3 9A3F039900    CALL 0099:033F
  312.     3281:37F8 59            POP CX
  313.     3281:37F9 837ED800      CMP WORD PTR [BP-28],+00
  314.     3281:37FD 7505          JNZ 3804
  315.  
  316.     Here is the first point of interest. The call on the following line will
  317. display the "what is xxxx" message. ----------─┐
  318.                                                │
  319.     3281:37FF 9A1B019900    CALL 0099:011B <───┘
  320.  
  321.     3281:3804 FF46D8        INC WORD PTR [BP-28]
  322.     3281:3807 837ED802      CMP WORD PTR [BP-28],+02
  323.     3281:380B 7D03          JGE 3810
  324.     3281:380D E9D2FE        JMP 36E2
  325.     3281:3810 8B46DA        MOV AX,[BP-26]
  326.     3281:3813 3D0500        CMP AX,0005
  327.     3281:3816 7603          JBE 381B
  328.     3281:3818 E97401        JMP 398F
  329.     3281:381B 8BD8          MOV BX,AX
  330.     3281:381D D1E3          SHL BX,1
  331.     3281:381F 2E            CS:
  332.     3281:3820 FFA72438      JMP [BX+3824]
  333.     3281:3824 3038          XOR [BX+SI],BH
  334.     3281:3826 6E            DB 6E
  335.     3281:3827 38AC38EA      CMP [SI+EA38],CH
  336.     3281:382B 3827          CMP [BX],AH
  337.     3281:382D 396439        CMP [SI+39],SP
  338.     3281:3830 B81000        MOV AX,0010
  339.     3281:3833 50            PUSH AX
  340.     3281:3834 16            PUSH SS
  341.     3281:3835 8D46E2        LEA AX,[BP-1E]
  342.     3281:3838 50            PUSH AX
  343.  
  344.     3281:3839 9AFB149900    CALL 0099:14FB
  345.     3281:383E 83C406        ADD SP,+06
  346.     3281:3841 8D46E2        LEA AX,[BP-1E]
  347.     3281:3844 50            PUSH AX
  348.     3281:3845 9A0F00B81B    CALL 1BB8:000F
  349.     3281:384A 59            POP CX
  350.     3281:384B 8B46DC        MOV AX,[BP-24]
  351.     3281:384E BA5800        MOV DX,0058
  352.     3281:3851 F7E2          MUL DX
  353.     3281:3853 05F740        ADD AX,40F7
  354.     3281:3856 50            PUSH AX
  355.     3281:3857 8D46E2        LEA AX,[BP-1E]
  356.     3281:385A 50            PUSH AX
  357.     3281:385B 9A0E00661A    CALL 1A66:000E
  358.     3281:3860 59            POP CX
  359.     3281:3861 59            POP CX
  360.     3281:3862 0BC0          OR AX,AX
  361.     3281:3864 7505          JNZ 386B
  362.     3281:3866 C746DEFFFF    MOV WORD PTR [BP-22],FFFF
  363.     3281:386B E92101        JMP 398F
  364.     3281:386E B81000        MOV AX,0010
  365.     3281:3871 50            PUSH AX
  366.     3281:3872 16            PUSH SS
  367.     3281:3873 8D46E2        LEA AX,[BP-1E]
  368.     3281:3876 50            PUSH AX
  369.     3281:3877 9AFB149900    CALL 0099:14FB
  370.     3281:387C 83C406        ADD SP,+06
  371.     3281:387F 8D46E2        LEA AX,[BP-1E]
  372.     3281:3882 50            PUSH AX
  373.     3281:3883 9A0F00B81B    CALL 1BB8:000F
  374.     3281:3888 59            POP CX
  375.     3281:3889 8B46DC        MOV AX,[BP-24]
  376.     3281:388C BA5800        MOV DX,0058
  377.     3281:388F F7E2          MUL DX
  378.     3281:3891 050841        ADD AX,4108
  379.     3281:3894 50            PUSH AX
  380.     3281:3895 8D46E2        LEA AX,[BP-1E]
  381.     3281:3898 50            PUSH AX
  382.     3281:3899 9A0E00661A    CALL 1A66:000E
  383.     3281:389E 59            POP CX
  384.     3281:389F 59            POP CX
  385.     3281:38A0 0BC0          OR AX,AX
  386.     3281:38A2 7505          JNZ 38A9
  387.     3281:38A4 C746DEFFFF    MOV WORD PTR [BP-22],FFFF
  388.     3281:38A9 E9E300        JMP 398F
  389.     3281:38AC B81000        MOV AX,0010
  390.     3281:38AF 50            PUSH AX
  391.     3281:38B0 16            PUSH SS
  392.     3281:38B1 8D46E2        LEA AX,[BP-1E]
  393.     3281:38B4 50            PUSH AX
  394.     3281:38B5 9AFB149900    CALL 0099:14FB
  395.     3281:38BA 83C406        ADD SP,+06
  396.     3281:38BD 8D46E2        LEA AX,[BP-1E]
  397.     3281:38C0 50            PUSH AX
  398.     3281:38C1 9A0F00B81B    CALL 1BB8:000F
  399.     3281:38C6 59            POP CX
  400.     3281:38C7 8B46DC        MOV AX,[BP-24]
  401.     3281:38CA BA5800        MOV DX,0058
  402.     3281:38CD F7E2          MUL DX
  403.     3281:38CF 051941        ADD AX,4119
  404.     3281:38D2 50            PUSH AX
  405.     3281:38D3 8D46E2        LEA AX,[BP-1E]
  406.     3281:38D6 50            PUSH AX
  407.     3281:38D7 9A0E00661A    CALL 1A66:000E
  408.     3281:38DC 59            POP CX
  409.     3281:38DD 59            POP CX
  410.     3281:38DE 0BC0          OR AX,AX
  411.     3281:38E0 7505          JNZ 38E7
  412.     3281:38E2 C746DEFFFF    MOV WORD PTR [BP-22],FFFF
  413.     3281:38E7 E9A500        JMP 398F
  414.     3281:38EA B81000        MOV AX,0010
  415.     3281:38ED 50            PUSH AX
  416.     3281:38EE 16            PUSH SS
  417.     3281:38EF 8D46E2        LEA AX,[BP-1E]
  418.     3281:38F2 50            PUSH AX
  419.     3281:38F3 9AFB149900    CALL 0099:14FB
  420.     3281:38F8 83C406        ADD SP,+06
  421.     3281:38FB 8D46E2        LEA AX,[BP-1E]
  422.     3281:38FE 50            PUSH AX
  423.     3281:38FF 9A0F00B81B    CALL 1BB8:000F
  424.     3281:3904 59            POP CX
  425.     3281:3905 8B46DC        MOV AX,[BP-24]
  426.     3281:3908 BA5800        MOV DX,0058
  427.     3281:390B F7E2          MUL DX
  428.     3281:390D 052A41        ADD AX,412A
  429.     3281:3910 50            PUSH AX
  430.     3281:3911 8D46E2        LEA AX,[BP-1E]
  431.     3281:3914 50            PUSH AX
  432.     3281:3915 9A0E00661A    CALL 1A66:000E
  433.     3281:391A 59            POP CX
  434.     3281:391B 59            POP CX
  435.     3281:391C 0BC0          OR AX,AX
  436.     3281:391E 7505          JNZ 3925
  437.     3281:3920 C746DEFFFF    MOV WORD PTR [BP-22],FFFF
  438.     3281:3925 EB68          JMP 398F
  439.     3281:3927 B81000        MOV AX,0010
  440.     3281:392A 50            PUSH AX
  441.     3281:392B 16            PUSH SS
  442.     3281:392C 8D46E2        LEA AX,[BP-1E]
  443.     3281:392F 50            PUSH AX
  444.  
  445.     Next point of interest. When you execute this line, the game will pause
  446. and wait for you to enter the code word from the manual.
  447.                                                       │
  448.     3281:3930 9AFB149900    CALL 0099:14FB <─────┘
  449.  
  450.     3281:3935 83C406        ADD SP,+06
  451.     3281:3938 8D46E2        LEA AX,[BP-1E]
  452.     3281:393B 50            PUSH AX
  453.     3281:393C 9A0F00B81B    CALL 1BB8:000F
  454.     3281:3941 59            POP CX
  455.     3281:3942 8B46DC        MOV AX,[BP-24]
  456.     3281:3945 BA5800        MOV DX,0058
  457.     3281:3948 F7E2          MUL DX
  458.     3281:394A 053B41        ADD AX,413B
  459.     3281:394D 50            PUSH AX
  460.     3281:394E 8D46E2        LEA AX,[BP-1E]
  461.     3281:3951 50            PUSH AX
  462.     3281:3952 9A0E00661A    CALL 1A66:000E
  463.     3281:3957 59            POP CX
  464.     3281:3958 59            POP CX
  465.     3281:3959 0BC0          OR AX,AX
  466.     3281:395B 7505          JNZ 3962
  467.     3281:395D C746DEFFFF    MOV WORD PTR [BP-22],FFFF
  468.     3281:3962 EB2B          JMP 398F
  469.     3281:3964 33D2          XOR DX,DX
  470.     3281:3966 B8B80B        MOV AX,0BB8
  471.     3281:3969 52            PUSH DX
  472.     3281:396A 50            PUSH AX
  473.  
  474.     Next point of interest. This call is the final evaluation of the entered
  475. word (or phrase). On return, it checks a checksum value. This whole next
  476. section of code (up to 3281:39Ad) simply test the validity of the keyword
  477. entered. I have marked the all jumps that happened when I entered my keyword
  478. with an " * ".
  479.  
  480.     3281:396B 9A71139900    CALL 0099:1371
  481.     3281:3970 59            POP CX
  482.     3281:3971 59            POP CX
  483.     3281:3972 8946E0        MOV [BP-20],AX
  484.     3281:3975 8B46DC        MOV AX,[BP-24]
  485.     3281:3978 BA5800        MOV DX,0058
  486.     3281:397B F7E2          MUL DX
  487.     3281:397D 8BD8          MOV BX,AX
  488.     3281:397F 8B874C41      MOV AX,[BX+414C]
  489.     3281:3983 3B46E0        CMP AX,[BP-20]
  490.     3281:3986 7505         *JNZ 398D
  491.     3281:3988 C746DEFFFF    MOV WORD PTR [BP-22],FFFF
  492.     3281:398D EB00          JMP 398F
  493.     3281:398F 837EDE00      CMP WORD PTR [BP-22],+00
  494.     3281:3993 7402         *JZ 3997
  495.     3281:3995 EB0C          JMP 39A3
  496.     3281:3997 FF46D6        INC WORD PTR [BP-2A]
  497.     3281:399A 837ED602      CMP WORD PTR [BP-2A],+02
  498.     3281:399E 7D03         *JGE 39A3
  499.     3281:39A0 E937FD        JMP 36DA
  500.     3281:39A3 837EDE00      CMP WORD PTR [BP-22],+00
  501.     3281:39A7 7504         *JNZ 39AD
  502.     3281:39A9 0E            PUSH CS
  503.     3281:39AA E8E8FC        CALL 3695
  504.  
  505.     This is the last point of interest. The next instruction is where we set
  506. the key (by moving FFFFh to the memory location DS:0744h). This is what we
  507. need to fake to allow the system to run.
  508.  
  509.     3281:39AD C7064407FFFF MOV WORD PTR [0744],FFFF <───┘
  510.     3281:39B3 B8FFFF        MOV AX,FFFF
  511.     3281:39B6 50            PUSH AX
  512.     3281:39B7 9AC0479900    CALL 0099:47C0
  513.     3281:39BC 59            POP CX
  514.     3281:39BD 8BE5          MOV SP,BP
  515.     3281:39BF 5D            POP BP
  516.     3281:39C0 CB            RETF
  517.  
  518.     Ok, we have now finished the doc check, and control has returned (when
  519. the RETF instruction was executed) to 21DD:3EA9. We are now ready to continue
  520. with the game.
  521.  
  522.     Notice the instruction at 3281:39AD. This is where EFH sets that external
  523. flag. But how did I determine this. Well, by luck. If you look through the
  524. entire routine, you will not find any other instructions placing a value in
  525. the data segment (DS). And since I decided a long time ago that EFH was
  526. written in a higher level language, we can assume that it is writting to some
  527. variable.
  528.  
  529.     So, hoping that we have found the flag, we go back to step 1. This time,
  530. we manualy edit the word at DS:0744 and place the value FFFFh there. We then
  531. skip over the call the the doc check and execute the game. Then before our
  532. eyes, shit happenes. The game comes up, and everything is fine. By George
  533. you've got it.
  534.  
  535.     So how do we fix the program to always return a good doc check. Well, we
  536. could go about it 2 ways. The first, is you could simple modify the
  537. instruction at 3281:3935 to perform a long jump to 3281:39AD. This would
  538. force set the value no matter what was typed. But who the fuck wants to have
  539. to type anything. I sure don't so lets think of another way.
  540.  
  541.     If we look at the entire doc check routine, we will see that it does
  542. nothing but handle the doc check (remember when we first bypassed the check.
  543. The screen came up and everything looked fine until it dropped you out. So we
  544. can assume that the actual screen is not setup in doc check. So I suggest
  545. placing a small patch right in the begining of the doc check.
  546.  
  547.     But what should this patch do? (BTW: it's late and I don't know If I'm
  548. using ?s right. So if not TOO FUCKING BAD). Well, all it should do is place
  549. the value FFFFh at DS:0744h. Here is the assembly language routine to do it.
  550.  
  551.               50       PUSH AX
  552.               B8FFFF   MOV AX,FFFF
  553.               3E       DS:
  554.               A34407   MOV WORD PTR [0744],AX
  555.               58       POP AX
  556.               CB       RETF
  557.  
  558.     This small routine will place the value FFFFh at DS:744 and then exit
  559. back to the main loop. Simple huh (note, you don't really need the save AX or
  560. load AX with FFFFh for that matter but I did it for clarity).
  561.  
  562.     So now that we have the patch, and now where to put it, how do we get it
  563. there. Well, thats where the file editor comes in, but first you will need 2
  564. things. The hex equivlent of out patch (in this case the 10 bytes:
  565. 50,B8,FF,FF,3E,A3,44,07,58,CB) and some string to search for. I suggest
  566. usings the first 14 bytes of the routines we are going to write over (the
  567. code at address 3281:36A5). Those bytes are 55, 8B, EC, 83, EC, 2A, C7, 46,
  568. DE, 00, 00, B8, 06, and 00. When selecting the search string, select only
  569. instructions that ARN'T call, jump, loop or any instruction that has a memory
  570. address in them. This value will NOT be the same when you do the search.
  571.  
  572.     Now, using for file editor (I used PCTOOLS, but NORTON's will do) search
  573. for our string (55, 8B, etc). When it is found (somewhere near sector 200)
  574. write down the sector #. Now, go and edit that sector. Find our search string
  575. (55,8B, etc) and replace it with the patch string (50,B8,FF, etc). Now save
  576. the sector.
  577.  
  578.     Your down. Try playing the game. It should load up, and then go right
  579. from the title page (or the intro) to the game without stopping at the doc
  580. check. If your doesn't, then you fucked up. Restart from the beginning (NO,
  581. this file didn't fuck up, and I DON'T MAKE MISTAKES).
  582.  
  583.     Well, you did it. You have now removed your first doc check. Don't ya
  584. feel real good. With time, you will be able to remove any type of doc check.
  585.  
  586.     -Buckaroo
  587.       -Banzai
  588.  
  589.